#ifndef NUMBER_H
#define NUMBER_H

extern Object *Number_new(int);
extern Object *Number_eval(Object *);
extern char *Number_to_cstr(Object *);
extern Object *Number_equal(Object *, Object *);
extern int number_equal(Object *, Object *);

/* THESE ARE BECAUSE I AM LAZY AND ACCORDING TO LARRY WALL THAT MAKES ME GOOD */

#define MATH2_PROTO(op) extern Object * Number_##op (Object *, Object *)
	MATH2_PROTO(add);
	MATH2_PROTO(sub);
	MATH2_PROTO(mult);
	MATH2_PROTO(div);
	MATH2_PROTO(mod);
#undef MATH2_PROTO

#define Madd(x, y) ((x) + (y))
#define Msub(x, y) ((x) - (y))
#define Mmult(x, y) ((x) * (y))
#define Mdiv(x, y) ((x) / (y))
#define Mmod(x, y) ((x) % (y))

#define MATH2_FUNC(op) \
	Object * Number_##op (Object *x, Object *y) \
	{ \
		if (!number_p(x) || !number_p(y)) \
			return ONIL; \
		return Number_new( M##op (getnumber(x), getnumber(y))); \
	}

#endif /* !NUMBER_H */
